
#ifndef EDESIGNER_CORE
#define EDESIGNER_CORE

#include <sdk_global.h>

#include <QtCore/QObject>
#include <QtCore/QPointer>
#include <QList>
#include <WindowBase.h>
#include <PluginManager.h>
#include <ObjectInspectorWindow.h>
#include <DockedMainWindow.h>
#include <EObject.h>
QT_BEGIN_HEADER

QT_BEGIN_NAMESPACE


class EDesignerPluginManager;
class ObjectInspectorWindow;
class DockedMainWindow;
class ActionManager;
class PropertyEditorWindow;
class ClassDataBase;
class ClassDataBaseWindow;
class ModeControlDialog;
class CommandManager;
class FileSystem;
class SimulationManager;
class ClassFactory;
class LocalFileWindow;
class ResourceWindow;
class QDESIGNER_SDK_EXPORT EDesignerCore : public QObject
{
    Q_OBJECT
public:
    
    virtual ~EDesignerCore();

    EDesignerPluginManager *pluginManager() const;
	ObjectInspectorWindow* objectInspectorWindow() const;
	PropertyEditorWindow* propertyEditorWindow() const;
    ClassDataBaseWindow* classDataBaseWindow() const;
	DockedMainWindow* dockedMainWindow() const;
	ActionManager* actionManager() const;
	QList<WindowBase*> windowBaseList() const;
	ClassDataBase* classDataBase() const ;
    ModeControlDialog* modeControlDialog() const ;
    CommandManager* commandManager() const;
    FileSystem* fileSystem() const;
    SimulationManager* simulationManager() const;
    ClassFactory* classFactory() const;
    ResourceWindow* resourceWindow() const;

    WindowBase* getWindowBasePtrByName(const QString& name);

    void setCurrentObject(QSharedPointer<QObject> object_ptr);
    void setCurrentObjectInspectorItemText(const QString& text);
    QString getCurrentObjectInspectorItemText();
    void undo();
    void redo();

    QStandardItem* getRootItemPtr();

    void newFileByFilePath(const QString& file_path);
    void newFileByDialog();
    void newFile();

    void saveFile();
    void saveFileByDialog();
    void saveSimulationState();


    void loadFile(const QString& file_path);
    void loadFileByDialog();
    void loadSimulationState();

    void unableAllUI();
    void enableAllUI();

    QString getCurrentProjectDir();

    void simulationRunAsSingleThread();
    void simulationRunInMainThread();
    void simulationWaitUpdateEndAndStopSim();
    void simulationstopWaitUpdateEnd();

    void simulationStart();
    void simulationStop();
    void simulationPause();

    void aboutToQuit();

    EObject* creatObject(const QString& typeName);

	static EDesignerCore* instance();

    void hideMenuObjectInspector();
protected:

private:
	EDesignerCore(QObject *parent = 0);
	static EDesignerCore* _instance;
	EDesignerPluginManager* m_plugin_manager;
	ObjectInspectorWindow* m_objectInspectorWindow;
	PropertyEditorWindow* m_propertyEditorWindow;
	DockedMainWindow* m_dockedMainWindow;
	ActionManager* m_actionManager;
	QList<WindowBase*> m_windowBaseList;
	ClassDataBase* m_classDataBase;
    ClassDataBaseWindow* m_classDataBaseWindow;
    ModeControlDialog* m_modeControlDialog;
    CommandManager* m_commandManager;
    FileSystem* m_fileSystem;
    LocalFileWindow* m_localFileWindow;
    ResourceWindow* m_resourceWindow;
    SimulationManager* m_simulationManager;
    ClassFactory* m_classFactory;

};

QT_END_NAMESPACE

QT_END_HEADER

#endif // ABSTRACTFORMEDITOR_H
